/*-----------------------------------------------File Info------------------------------------------------
** File Name:               BleModule.c  
** Last modified date:      2016.07.22
** Last version:            V0.1
** Description:             
**--------------------------------------------------------------------------------------------------------            
** Created date:            2016.09.07
** author:                  YLY
** Version:                 V0.1
** Descriptions:            任务1 
**--------------------------------------------------------------------------------------------------------
*/
#ifndef _BLE_TASK_H_
#define _BLE_TASK_H_
#include "userConfig.h"
/*************************************************************
* 	include 
* 	头文件	
*************************************************************/ 
/* 打印定义 */
#define BLE_DEBUG 		0	
#if BLE_DEBUG
	#define BLE_PRINTF	USERPRINTF	
	//#define BLE_INFO	USERPRINTF
	#define BLE_INFO(x,...)		
#else
	#define BLE_PRINTF(x,...)
	#define BLE_INFO(x,...)	
#endif

#define BLE_INIT_MAX_TIMES  5			/* BLE初始化 */


typedef struct strBle
{
	uint8_t bleWorkMode;
	uint8_t bleSetStatus;
	uint8_t setTimes;
}tsBle;

enum enBleWarkMode
{
	AT_MODE=10,
	THROUGH_MODE,
};

enum enBleInitStatus	/* 所有任务消息需要大于0x0f,避免与系统消息冲突*/
{
	IDLE = 10,			/* 空闲状态 */
	WAIT_ENTER_AT ,		/* 等待进入AT */
	WAIT_CLOSE_ECHO,	/* 等待关闭回显 */
	WAIT_SET_NAME,		/* 等待设置名称*/
	WAIT_SET_TYPE_ID,	/* 等待设置设备类型及ID*/
};

extern tsBle tBle;


#define GET_BLE_WORK_MODE() tBle.bleWorkMode	/* 获取BLE工作模式, AT_MODE or THROUGH_MODE*/

extern void initBle(void);
extern void setBleParameter(void);			/* 调用此函数,BLE开始设置参数 */
extern void setBleHandle(char *pRece, char *pName, uint8_t *pDeviceId, uint8_t deviceType);

#endif		/*_BLE_TASK_H_*/


